<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <style>
    body {
      margin: 0;
      padding: 0;
      width: 100vw;
      height: 100vh;
    }
    #app {
      width: 100%;
      height: 100%;
      display: flex;
      padding: 0 10%;
      box-sizing: border-box;
      flex-direction: column;
      gap: 10px;
    }

    input {
      padding: 10px;
      box-sizing: border-box;
      border: 1px solid #a18cd1;
      border-radius: 5px;
    }
    button {
      padding: 10px;
      border: none;
      border-radius: 5px;
      color: #ffffff;
      margin-top: 30px;
      background-image: linear-gradient(-90deg, #a18cd1 0%, #fbc2eb 100%);
    }

    .logo {
      width: 100px;
      height: 100px;
      margin: 40% auto;
    }
    .logo img {
      width: 100%;
      height: 100%;
    }
  </style>
  <body>
    <div id="app">
      <div class="logo">
        <img src="./logo.webp" />
      </div>
      <div>请输入您的用户名</div>
      <input type="text" placeholder="请输入内容" v-model="userName" />
      <button @click="join">加入群聊</button>
    </div>
  </body>
  <script src="./vue.global.min.js"></script>
  <script>
    const { createApp, ref, reactive,onMounted } = Vue;
    createApp({
       
      setup() {
        const userName = ref("");

        onMounted(() => {
          userName.value = ""
        })

        function join() {
          if (!userName.value) {
            alert("请输入用户名");
            return;
          }
          window.location.href = `./index.html?userName=${userName.value}`;
        }
        return {
          userName,
          join,
        };
      },
    }).mount("#app");
  </script>
</html>
